﻿@model protogen.site.Controllers.HomeController.DecodeModel
@{
    ViewData["Title"] = "Decode";
}
<h2>@ViewData["Title"].</h2>

@if(Model.ContainsValue)
{
    <div>@Html.Partial("DecodeBytes", Model)</div>
}
<p>This tool will pull apart arbitrary protobuf data (without requiring a schema), displaying the hierarchical content.</p>
<form method="post">
    <div><textarea rows="5" style="width:100%; max-width: unset" name="hex" type="text" placeholder="encoded hex">@Model.AsHex()</textarea></div>
    <div><input type="submit" value="hex"/> <label for="hex_deep"><input id="hex_deep" type="checkbox" name="deep" value="true" checked="@Model.Deep" /> recursively</label></div>
</form>
<hr />
<form method="post">
    <div><textarea rows="5" style="width:100%;  max-width: unset" name="base64" type="text" placeholder="encoded base64">@Model.AsBase64()</textarea></div>
    <div><input type="submit" value="base-64"/> <label for="base64_deep"><input id="base64_deep" type="checkbox" name="deep" value="true" checked="@Model.Deep" /> recursively</label></div>
</form>
<hr />
<form method="post" enctype="multipart/form-data">
    <div>
        <input name="file" type="file" width="40"/> (max file size: @(protogen.site.Controllers.HomeController.MaxFileLength) bytes)
        <input type="submit" value="upload" /> <label for="file_deep"><input id="file_deep" type="checkbox" name="deep" value="true" checked="@Model.Deep" /> recursively</label>
    </div>
</form>